package com.youi.service;

import com.youi.entity.User;
import com.youi.entity.Yibaopayment;
import com.youi.exception.BusinessException;

import java.io.IOException;

public interface YibaopaymentService extends BaseService<Yibaopayment> {

    /**
     * 根据订单流水号(支付单)支付
     *
     * @param serialNumber 订单流水号(主订单号)
     * @param user         用户
     * @param requestIp    用户真实IP
     * @return
     * @throws BusinessException
     * @throws IOException
     */
    Yibaopayment payBySerialNumber(String serialNumber, User user, String requestIp) throws BusinessException, IOException;

    /**
     * 根据订单号(订单)支付
     *
     * @param orderId   订单
     * @param user      用户
     * @param requestIp 用户真实IP
     * @return
     * @throws BusinessException
     * @throws IOException
     */
    Yibaopayment payByOrderId(Long orderId, User user, String requestIp) throws BusinessException, IOException;

    /**
     * 支付成功后，小程序端回调处理
     *
     * @param serialNumber  订单流水号(主订单号)
     * @param uniqueOrderNo 易宝订单流水号
     * @throws BusinessException
     * @throws IOException
     */
    void callBackForMiniApp(String serialNumber, String uniqueOrderNo) throws BusinessException, IOException;

}